package actor;

import view.ActorView;

public abstract class Actor {
    private String name;
    private int speed;
    private int power;
    private final int life;
    private int health;
    private ElementType type;
    private final String image;
    private boolean alive;

    public Actor(String name, int speed, int power, int life, String image, ElementType type) {
        this.name = name;
        this.speed = speed;
        this.power = power;
        this.life = life;
        this.health = life;
        this.type = type;
        this.image = image;
        this.alive = true;
    }

    public abstract int attack(ActorView actorView);

    public int getSpeed() {
        return speed;
    }

    public int getPower() {
        return power;
    }

    public int getLife() {
        return life;
    }

    public int getHealth() {
        return health;
    }

    public String getName() {
        return name;
    }

    public String getImage() {
        return image;
    }

    public ElementType getType() {
        return type;
    }

    public void setSpeed(int speed) {
        this.speed = speed;
    }

    public void setPower(int power) {
        this.power = power;
    }

    public void setHealth(int health) {
        this.health = health;
    }

    public int minusHealth(int minus) {
        this.health -= minus;
        if (this.health <= 0) {
            this.health = 0;
            alive=false;
            speed=0;
        }
        return this.health;
    }

    public boolean isAlive() {
        return alive;
    }
}
